package com.otitan.la.forest.industry.vo;

import lombok.Data;

import java.math.BigDecimal;

/**
 * @Description: 当前类作用描述
 * @Author: xiazw
 * @CreateDate: 2020/10/20 20:31
 */
@Data
public class ThreeProductAccountedVO {
    private BigDecimal thiForeproTotal;
    private BigDecimal secNowoodcraftTaotal;
    private BigDecimal thiTourandlieTotal;
    private BigDecimal thiExpertiseTotal;
    private BigDecimal thiTatalTatalvalue;
    private String thiForeproTotalAccounted;
    private String secNowoodcraftTaotalAccounted;
    private String thiTourandlieTotalAccounted;
    private String thiExpertiseTotalAccounted;
    private String thiTatalTatalvalueAccounted;

    public ThreeProductAccountedVO() {
    }

    public ThreeProductAccountedVO(BigDecimal thiForeproTotal, BigDecimal secNowoodcraftTaotal, BigDecimal thiTourandlieTotal,
                                   BigDecimal thiExpertiseTotal, BigDecimal thiTatalTatalvalue) {
        this.thiForeproTotal = thiForeproTotal;
        this.secNowoodcraftTaotal = secNowoodcraftTaotal;
        this.thiTourandlieTotal = thiTourandlieTotal;
        this.thiExpertiseTotal = thiExpertiseTotal;
        this.thiTatalTatalvalue = thiTatalTatalvalue;
        BigDecimal allcount=thiForeproTotal.add(secNowoodcraftTaotal).add(thiTourandlieTotal).add(thiExpertiseTotal).add(thiTatalTatalvalue);
        this.thiForeproTotalAccounted=thiForeproTotal.divide(allcount,4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%";
        this.secNowoodcraftTaotalAccounted=secNowoodcraftTaotal.divide(allcount,4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%";
        this.thiTourandlieTotalAccounted=thiTourandlieTotal.divide(allcount,4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%";
        this.thiExpertiseTotalAccounted=thiExpertiseTotal.divide(allcount,4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%";
        this.thiTatalTatalvalueAccounted=thiTatalTatalvalue.divide(allcount,4, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"))+"%";
    }
    public ThreeProductAccountedVO getThreeProductAccounted(ThreeProductAccountedVO three){
        return new ThreeProductAccountedVO(three.getThiForeproTotal(), three.getSecNowoodcraftTaotal(),three.getThiTourandlieTotal(),
                three.getThiExpertiseTotal(), three.getThiTatalTatalvalue());
    }
}
